# 循环嵌套
import time

for x in range(5):
    for y in range(5):
        print(x,end="\t")
    print()

# 99乘法表
# for n in range(1,5+1):
#     print("{0}*{1}={2}".format(5,n,5*n),end="\t")

for m in range(1,9+1):
    for n in range(1,9+1):
        if m >= n:
            print("{0}*{1}={2}".format(n,m,m*n),end="\t")
    print()

for m in range(1,9+1):
    for n in range(1,m+1):
            print("{0}*{1}={2}".format(n,m,m*n),end="\t")
    print()


# while True:
#     a = input("请输入一个字符(Q/q表示结束 )")
#     if a.upper() == "Q":
#         print("结束循环，退出")
#         break
#     else:
#         print(a)
#         time.sleep(1)


# else, 如没有被break执行，则会执行else
'''
salarySum = 0
salarys = []
for i in range(4):
    a = input("请输入一个数字(Q/q表示结束 )")
    if a.upper() == "Q":
        print("结束循环，退出")
        break
    if float(a) < 0:
        break
    salarySum += float(a)
    salarys.append(float(a))
else:
    print("输入完成！")
    time.sleep(1)
print("录入薪资：", salarys)
print("录入总薪资：", salarySum)
print("录入平均薪资：", salarySum/len(salarys))
'''

# 优化
## zip()并行迭代,或其它方法
names = ("高强", "高尔忠", "Tony", "吴逸滔")
ages = (40, 55, 42)
jobs = ("富二代", "boss", "engineer")

for name, age, job in zip(names, ages, jobs):
    print("{0}-{1}-{2}".format(name, age, job))
for i in range(min(len(names), len(ages), len(jobs))):
    print("{0}-{1}-{2}".format(names[i], ages[i], jobs[i]))